//
//  LeftTableViewCell.m
//  JunZeWristband
//
//  Created by Kendama on 2017/8/17.
//  Copyright © 2017年 DT. All rights reserved.
//

#import "LeftTableViewCell.h"

NSString *const kLeftTableViewCellIdentifier = @"kLeftTableViewCellIdentifier";

@implementation LeftTableViewCell

+ (instancetype)dequeueReusableWithTableView:(UITableView *)tableView
{
    LeftTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kLeftTableViewCellIdentifier];
    if (cell == nil)
    {
        cell = [[LeftTableViewCell alloc]init];
    }
    return cell;
}

- (instancetype)init
{
    self = [super initWithStyle:UITableViewCellStyleDefault reuseIdentifier:kLeftTableViewCellIdentifier];
    if (self)
    {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.backgroundColor = [UIColor clearColor];
        [self masLayoutSubview];
    }
    return self;
}

- (UIImageView *)iconImageView
{
    if(!_iconImageView)
    {
        UIView *superView = self.contentView;
        _iconImageView = [[UIImageView alloc]init];
        [superView addSubview:_iconImageView];
    }
    return _iconImageView;
}
- (UILabel *)titleLabel
{
    if(!_titleLabel)
    {
        UIView *superView = self.contentView;
        _titleLabel = [[UILabel alloc]init];
        [superView addSubview:_titleLabel];
        [_titleLabel setFont:[UIFont systemFontOfSize:15]];
        [_titleLabel setTextColor:[UIColor darkGrayColor]];
    }
    return _titleLabel;
}
- (UILabel *)numberLabel
{
    if(!_numberLabel)
    {
        UIView *superView = self.contentView;
        _numberLabel = [[UILabel alloc]init];
        [superView addSubview:_numberLabel];
        [_numberLabel setFont:[UIFont systemFontOfSize:13]];
        _numberLabel.layer.cornerRadius = px1920Height(60)/2;
        _numberLabel.clipsToBounds = YES;
        [_numberLabel setTextColor:[UIColor whiteColor]];
        _numberLabel.textAlignment = NSTextAlignmentCenter;
    }
    return _numberLabel;
}


- (void)masLayoutSubview
{
    __weak UIView *superView = self.contentView;
    [self.iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(superView.mas_centerY);
        make.left.mas_equalTo(superView.mas_left).with.offset(px1080Width(96));
    }];
    
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(superView.mas_centerY);
        make.left.mas_equalTo(self.iconImageView.mas_right).with.offset(px1080Width(47));
    }];
    
    [self.numberLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(superView.mas_centerY);
        make.right.mas_equalTo(superView.mas_right).with.offset(px1080Width(-47));
        make.height.mas_equalTo(px1920Height(60));
        make.width.mas_equalTo(px1080Width(90));
    }];
}



- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
